package edu.scau.comeva.rigcontrol.entity;

import org.hibernate.annotations.CollectionId;
import org.hibernate.annotations.Type;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Set;

/**
 * Created with IntelliJ IDEA.
 * User: Dan
 * Date: 13-8-18
 * Time: 上午1:03
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table
public class m_role implements Serializable {
    private long role_id;
    private int role_kind;//1为学生，2为测评小组，3为管理员
    private Set<m_module> role_modules;

    @Id
    @GeneratedValue
    public long getRole_id() {
        return role_id;
    }

    public void setRole_id(long role_id) {
        this.role_id = role_id;
    }

    public int getRole_kind() {
        return role_kind;
    }

    public void setRole_kind(int role_kind) {
        this.role_kind = role_kind;
    }

    @ManyToMany
    @JoinTable(
            name = "m_role_module",
            joinColumns = @JoinColumn(name = "fk_role_id",referencedColumnName = "role_id"),
            inverseJoinColumns = @JoinColumn(name = "fk_module_id",referencedColumnName = "module_id")
    )
    public Set<m_module> getRole_modules() {
        return role_modules;
    }

    public void setRole_modules(Set<m_module> role_modules) {
        this.role_modules = role_modules;
    }
}
